import { useReactive } from "ahooks";
import { useModel } from "umi";
import { useEffect } from "react";
import compress from "gql-compress";

const useAllOrderLogistics = () => {
    const { graphqlFetch } = useModel("global");

    const state = useReactive({
        orderLogisticsLoading: false,
        orderLogistics: [],
    });

    const loadAllOrderLogistics = async () => {
        state.orderLogisticsLoading = true;
        // let res = await graphqlFetch({
        //     query,
        //     variables: {},
        // });
        // let commodities = res?.a?.nodes || [];
        let orderLogistics = [0, 1, 3, 3, 3, 3, 3]
        state.orderLogistics = orderLogistics;
        state.orderLogisticsLoading = false;
        // return commodities;
    };

    return { ...state, loadAllOrderLogistics };
};

//通过订单ID查询物流信息
const query = compress(``);

export default useAllOrderLogistics;
